package com.test.day04.inputStream;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Arrays;

/**
 * @program: 字节输入流一次读取多个字节的方法：
 * @author: luhd
 * @create: 2021-08-05
 */
public class Demo02InputStream {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("b.txt");
        byte[] bytes = new byte[2];
        int len = fis.read(bytes); // 返回bytes的大小，读取的数据存放在了bytes里
        System.out.println(len);
        //System.out.println(Arrays.toString(bytes));
        System.out.println(new String(bytes));
        fis.close();
    }
}
